﻿using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Share;

public class SampleJobListener : IJobListener
{
    public string Name => "JobListener";

    public Task JobExecutionVetoed(IJobExecutionContext context, CancellationToken cancellationToken = default)
    {
        Console.WriteLine("From job listener : Job is vetoed");
        //return Task.Delay(1000, cancellationToken);
        return Task.CompletedTask;
    }

    public Task JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default)
    {
        Console.WriteLine("From job listener : Job to be executed");
        //return Task.Delay(1000, cancellationToken);
        return Task.CompletedTask;
    }

    public Task JobWasExecuted(IJobExecutionContext context, JobExecutionException? jobException, CancellationToken cancellationToken = default)
    {
        Console.WriteLine("From job listener : Job was executed");
        //return Task.Delay(1000, cancellationToken);
        return Task.CompletedTask;
    }
}
